﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SmartParking.Web.Manager
{
    public partial class Logger : System.Web.UI.MasterPage
    {
        public string Title
        {
            get
            {
                return (Master as Manager.ManagerTemplate).Title;
            }
            set
            {
                (Master as Manager.ManagerTemplate).Title = value;
            }
        }

        public string ActiveMenuItem
        {
            set
            {
                mnuHome.Attributes.Remove("class");
                mnuParkings.Attributes.Remove("class");
                mnuCustomers.Attributes.Remove("class");
                mnuManagers.Attributes.Remove("class");
                mnuSecurity.Attributes.Remove("class");
                mnuRolePermissions.Attributes.Remove("class");
                mnuLog.Attributes.Remove("class");
                switch (value)
                {
                    case "Home":
                        mnuHome.Attributes.Add("class", "current_page_item");
                        break;
                    case "Parkings":
                        mnuParkings.Attributes.Add("class", "current_page_item");
                        break;
                    case "Customers":
                        mnuCustomers.Attributes.Add("class", "current_page_item");
                        break;
                    case "Managers":
                        mnuManagers.Attributes.Add("class", "current_page_item");
                        break;
                    case "Security":
                        mnuSecurity.Attributes.Add("class", "current_page_item");
                        break;
                    case "RolePermissions":
                        mnuRolePermissions.Attributes.Add("class", "current_page_item");
                        break;
                    case "Log":
                        mnuLog.Attributes.Add("class", "current_page_item");
                        break;
                }
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            MainMenuItems.Visible = HttpContext.Current.User.Identity.IsAuthenticated;            
        }
    }
}
